from celery_tasks.main import app
from . import constants
from .yuntongxun.sms import CCP
import logging

logger = logging.getLogger("django")


@app.task(name="send_sms_code")
def send_sms_code(mobile, sms_code):
    CCP().send_template_sms(mobile, [sms_code, constants.SMS_CODE_REDIS_EXPIRES // 60], constants.SEND_SMS_TEMPLATE_ID)
    logger.debug("%s:%s" % (mobile, sms_code))
